package com.flightcloud.ssm;

import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
import org.beetl.ext.spring.BeetlSpringView;
import org.beetl.ext.spring.BeetlSpringViewResolver;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;

public class BeetlConfig {

	@Bean(name = "beetlConfig", initMethod = "init")
	public BeetlGroupUtilConfiguration beetlGroupUtilConfiguration() {
		return new BeetlGroupUtilConfiguration();
	}

	@Bean
	public BeetlSpringViewResolver beetlSpringViewResolver(
			@Qualifier("beetlConfig") BeetlGroupUtilConfiguration beetlGroupUtilConfiguration) {
		BeetlSpringViewResolver viewResolver = new BeetlSpringViewResolver();
		viewResolver.setConfig(beetlGroupUtilConfiguration);
		viewResolver.setViewClass(BeetlSpringView.class);
		viewResolver.setCache(false);
		viewResolver.setSuffix(".html");
		viewResolver.setRequestContextAttribute("rc");
		viewResolver.setContentType("text/html;charset=utf-8");
		// 设置视图的优先级，值越小，优先级越高
		viewResolver.setOrder(0);
		return viewResolver;
	}
}
